<template>
    <van-cell class="song-item" @click="clickHandle">
        <template #title>
            <slot name="title">
                {{title}}
            </slot>
        </template>
        <i class="icon iconfont icon-download" @click.stop="download"></i>
    </van-cell>
</template>

<script>
import { downloadFn } from 'Utils/utils'
export default {
    name: 'SongItem',
    props: {
        title: {
            type: String,
            default: ''
        },
        hash: {
            type: String,
            required: true
        }
    },
    methods: {
        clickHandle () {
            // 播放
            this.$Music.init(this.hash)
        },
        download () {
            // 下载
            downloadFn()
        }
    }
}
</script>

<style lang="scss" scoped>
.song-item {
    padding-top: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e5e5;
    .icon {
        font-size: 1.4rem;
    }
}
</style>
